<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>企业注册 - 测盟汇系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        :root {
            --primary-color: #2c5545;
            --primary-light: #3a7d62;
            --primary-hover: #1e4636;
            --accent-color: #8ba888;
            --error-color: #d64541;
            --success-color: #3a7d62;
            --text-color: #333;
            --text-light: #555;
            --border-color: #d1d9d6;
            --bg-light: #f5f7f6;
            --bg-page: #e8ecea;
            --white: #fff;
            --shadow: 0 4px 24px rgba(44, 85, 69, 0.1);
            --radius: 12px;
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: var(--bg-page);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: var(--text-color);
            line-height: 1.6;
            background-image: linear-gradient(135deg, #f5f7f6 0%, #e1e8e4 100%);
        }

        .container {
            width: 100vw;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .card {
            background: var(--white);
            padding: 2.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            width: 100%;
            max-width: 600px;
            position: relative;
            overflow: hidden;
            transition: var(--transition);
            border: 1px solid rgba(44, 85, 69, 0.1);
        }

        .card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: var(--primary-color);
        }

        .logo {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .logo i {
            font-size: 2.5rem;
            color: var(--primary-color);
            margin-bottom: 0.5rem;
        }

        h2 {
            text-align: center;
            margin-bottom: 1.8rem;
            color: var(--primary-color);
            font-weight: 600;
            letter-spacing: 1px;
        }

        .form-row {
            display: flex;
            gap: 1rem;
        }

        .form-group {
            margin-bottom: 1.2rem;
            position: relative;
            flex: 1;
        }

        .form-group i {
            position: absolute;
            left: 15px;
            top: 42px;
            color: var(--primary-light);
            font-size: 1rem;
        }

        label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--primary-color);
            font-weight: 500;
        }

        label.required::after {
            content: '*';
            color: var(--error-color);
            margin-left: 4px;
        }

        input[type="text"],
        input[type="password"],
        input[type="email"],
        input[type="tel"],
        select {
            width: 100%;
            padding: 0.8rem 0.8rem 0.8rem 2.5rem;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 1rem;
            background: var(--bg-light);
            transition: var(--transition);
            color: var(--text-color);
        }

        select {
            padding-left: 0.8rem;
            appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c5545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 0.8rem center;
            background-size: 1rem;
        }

        input:focus,
        select:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.2);
            background: var(--white);
        }

        .error {
            color: var(--error-color);
            margin: 0.8rem 0;
            text-align: center;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(214, 69, 65, 0.1);
            padding: 0.5rem;
            border-radius: 4px;
        }

        .error i {
            margin-right: 0.5rem;
        }

        button {
            width: 100%;
            padding: 0.9rem;
            background: var(--primary-color);
            color: var(--white);
            border: none;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            margin-top: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            letter-spacing: 1px;
        }

        button i {
            margin-right: 0.5rem;
        }

        button:hover {
            background: var(--primary-hover);
        }

        .links {
            display: flex;
            justify-content: center;
            margin-top: 1.5rem;
            font-size: 0.95rem;
        }

        .links a {
            color: var(--primary-light);
            text-decoration: none;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }

        .links a:hover {
            color: var(--primary-color);
            text-decoration: underline;
        }

        .links a i {
            margin-right: 0.3rem;
        }

        .footer {
            text-align: center;
            margin-top: 2rem;
            color: var(--primary-light);
            font-size: 0.9rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
        }

        @media (max-width: 768px) {
            .form-row {
                flex-direction: column;
                gap: 0;
            }

            .card {
                padding: 1.8rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <div class="card">
        <div class="logo">
            <i class="fas fa-building"></i>
        </div>
        <h2>企业用户注册</h2>

        <form th:action="@{/enterprise/register}" method="post">
            <!-- 账号信息 -->
            <div class="form-group">
                <label for="account" class="required">企业账号</label>
                <i class="fas fa-user-tie"></i>
                <input type="text" id="account" name="account" placeholder="请输入企业账号" required />
            </div>

            <div class="form-row">
                <div class="form-group">
                    <label for="password" class="required">密码</label>
                    <i class="fas fa-lock"></i>
                    <input type="password" id="password" name="password" placeholder="请输入密码" required />
                </div>

                <div class="form-group">
                    <label for="confirmPassword" class="required">确认密码</label>
                    <i class="fas fa-lock"></i>
                    <input type="password" id="confirmPassword" name="confirmPassword" placeholder="请再次输入密码" required />
                </div>
            </div>

            <!-- 企业信息 -->
            <div class="form-group">
                <label for="enterpriseName" class="required">企业名称</label>
                <i class="fas fa-building"></i>
                <input type="text" id="enterpriseName" name="enterpriseName" placeholder="请输入企业名称" required />
            </div>

            <div class="form-group">
                <label for="contactInfo" class="required">联系方式</label>
                <i class="fas fa-phone"></i>
                <input type="tel" id="contactInfo" name="contactInfo" placeholder="请输入联系邮箱" required />
            </div>

            <div th:if="${error}" class="error">
                <i class="fas fa-exclamation-circle"></i>
                <span th:text="${error}"></span>
            </div>

            <button type="submit">
                <i class="fas fa-user-plus"></i> 注册
            </button>

            <div class="links">
                <a th:href="@{/user/login}">
                    <i class="fas fa-sign-in-alt"></i> 已有账号？立即登录
                </a>
            </div>
        </form>

        <div class="footer">
            <p>© 2025 测盟汇系统 | 版本 1.0.0</p>
        </div>
    </div>
</div>

<script>
    // 密码匹配验证
    document.getElementById('confirmPassword').addEventListener('blur', function() {
        const password = document.getElementById('password').value;
        const confirmPassword = this.value;

        if (password !== confirmPassword) {
            this.setCustomValidity('两次输入的密码不一致');
        } else {
            this.setCustomValidity('');
        }
    });

    // 自动聚焦到第一个输入框
    document.addEventListener('DOMContentLoaded', function() {
        document.getElementById('account').focus();
    });
</script>
</body>
</html>